{% extends 'backstage/admin/manage_task/base.html' %}
{% from 'bootstrap/pagination.html' import render_pagination %}

{% block task_content %}
    {% if is_start() %}
        <div class="table-responsive">
            <table class="table table-striped table-hover table-sm">
                <thead>
                <tr class="text-center">
                    <th>#</th>
                    <th>{{ _('Team number') }}</th>
                    <th>{{ _('Problem') }}</th>
                    <th>{{ _('UUID') }}</th>
                    <th>{{ _('Actions') }}</th>
                </tr>
                </thead>
                {% for solution in pagination.items %}
                    <tr>
                        <td class="text-center">{{ config['SOLUTION_PER_PAGE']*(page-1) + loop.index }}</td>
                        <td class="text-center">
                            <span class="badge badge-pill badge-info">
                                {{ solution.team_number }}
                            </span>
                        </td>
                        <td class="text-center">
                            <span class="badge badge-pill badge-primary">
                                {{ solution.problem }}
                            </span>
                        </td>
                        <td class="text-center">
                            <a href="{{ url_for('backstage.get_solution', filename=solution.uuid) }}"
                               target="_blank">
                                {{ solution.uuid }}
                            </a>
                        </td>
                        <td class="text-center">
                            <form role="form"
                                  action="{{ url_for('admin.task_add', user_id=user_id, solution_id=solution.id) }}"
                                  method="post">
                                <input type="hidden" id="csrf_token" name="csrf_token" value="{{ csrf_token() }}"/>
                                <button class="btn btn-info btn-sm">
                                    <span class="oi oi-plus"></span> {{ _("Add") }}
                                </button>
                            </form>
                        </td>
                    </tr>
                {% endfor %}
            </table>
        </div>
        <div class="page-footer">
            {{ render_pagination(pagination) }}
        </div>
    {% else %}
        {% include "backstage/tips/no_start.html" %}
    {% endif %}
{% endblock %}
